package dk.dashboardFP.interactionElementFramwork.inputElementViews {
	import dk.dashboardFP.panels.ui.text.label.InputLabel;
	import dk.dashboardFP.panels.ui.text.label.InputLabelEvent;

	/**
	 * @author jk
	 */
	public class TextInputView extends AbstractInputElementView {
		
		protected var _doLabel : InputLabel;
		
		public function TextInputView() {
			super();
			setup();
		}
		
		private function setup() : void {
			createLabel();
		}
		
		protected function createLabel() : void {
			_doLabel = new InputLabel();
			addChild(_doLabel);
			
			_doLabel.addEventListener(InputLabelEvent.ENTERED_DEFAULT_VALUE, onEnterDefault, false, 0, true);
			_doLabel.addEventListener(InputLabelEvent.LEFT_DEFAULT, onLeaveDefault, false, 0, true);
		}
		

		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		// default state change dispatch
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		
		private function onEnterDefault(event : InputLabelEvent) : void {
			dispatchDefaultEnter();
		}

		private function onLeaveDefault(event : InputLabelEvent) : void {
			dispatchDefaultLeave();
		}
		
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		// enable disable
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		override public function disable() : void {
			super.disable();
			_doLabel.lock();		}

		override public function enable() : void {
			super.enable();
			_doLabel.unLock();
		}

		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		// getter setters
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

		public function get doLabel() : InputLabel {
			return _doLabel;
		}
		override public function focusIn() : void {
			super.focusIn();
		}
	}
}
